﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ifunction.Fiddler.Configurator.Control
{
    /// <summary>
    /// Interaction logic for LoadingMask.xaml
    /// </summary>
    public partial class LoadingMask : UserControl
    {
        public LoadingMask()
        {
            InitializeComponent();


        }       

        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            Grid grid = sender as Grid;
            var coreLeft = grid.ActualHeight > this.loadingCore.Width ? ((grid.ActualHeight - this.loadingCore.Width) / 2) : 0;
            var coreTop = grid.ActualWidth > this.loadingCore.Height ? ((grid.ActualWidth - this.loadingCore.Height) / 2) : 0;

            this.loadingCore.SetValue(Canvas.LeftProperty, coreLeft);
            this.loadingCore.SetValue(Canvas.TopProperty, coreTop);
        }
    }
}
